<!--Generate by Kevin's CodeBuilder -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
		<meta charset="UTF-8">
		<title>bui-ssm快速开发框架</title>
		<head th:include="source::header"></head>
</head>
<body>
		<div class="form_main_wrap">
			<div class="form_condition" >
				<table class="form_table">
					<tr>
						<td class="label label100">[(${Lang.func_menu})]</td>
						<td><input id="menuTree" name="menuTree" class="form_input form_input50" type="text"/></td>
					</tr>
					<tr>
						<td colspan="2" style="padding-left:150px">
							<button class="k_icon_fff" id="search_btn">
								<i class="fa fa-search"></i>
								[(${Lang.common_search})]
							</button>
						</td>
					</tr>
				</table>
			
			</div>
			<div class="form_grid">
				<table id="datagrid"></table>
			</div>
		</div>
</div>
<script type="application/javascript" th:inline="javascript">
		var curdObj,
			box,
			$win,
			height = 280,
			gridOpts = [(${dataGridJson})];//获取datagrid配置json			
			var title = "[(${Lang.func_windowTitle})]";//国际化语言
			gridOpts.title = title;
		var menuJson = [(${menuJson})];
		
		function getParams(){
			return {
					menuId : box.val()
				};
		}
		
		$(function () {
			var dg = $("#datagrid");
			//排序
			gridOpts.sortField = {"menuId":"asc"};
			curdObj = new $B.CURD(dg, gridOpts);			
			var opts = {
			        data: menuJson,//数据 参考树数据
		            default: {
		                "id": '',
		                "text": "[(${Lang.common_all})]"
		            },
		            placeholder: "[(${Lang.common_pleaseSelected})]", //默认选择项目
	                nodeParentIcon: 'fa-folder-empty',//父节点图标关闭状态
	                nodeParentOpenIcon: 'fa-folder-open-empty',      //打开状态图标
	                leafNodeIcon: 'fa-doc',                //子节点图标
		            checkox:false,
		            mutilChecked:false,	          
		            checkfather: false, // 单选的时候，是否可以选择父节点
		            readonly: true, //不可以编辑                
		            plainStyle: false, //\"true\" 为简单无图标样式
		            textField: 'text', //菜单名称字段，默认为text
		            idField: 'id', //菜单id字段,默认为id
		        };
			var $tree = $("#menuTree");
			box = new $B.Combox($tree, opts);
			$("#search_btn").click(function(){
				var prs = {
					menuId : box.val()
				};
				curdObj.reload(prs);
			});
		});
		//打开form.html
		function _openForm(prs,isUpdate,rowData){
			var opts = {
				dataType:'html',
				title:title,
				width:700,
				height:height
			};
			if(isUpdate && rowData){
				opts.rowData = rowData;
			}
			curdObj.window(opts,isUpdate);
		};
		/******工具栏事件集合******/
		window.toolMethods = {
			addFn:function(prs){
				_openForm(prs);
			},
			updateFn:function(prs){
				_openForm(prs,true);
			},
			deleteFn:function(prs){
				curdObj.delChecked();
			},
			lineUpdateFn:function(prs){
				_openForm(prs,true,prs);
			},
			lineDeleteFn:function(prs){
				curdObj.deleteData([prs.id]);
			},
			exportFn:function(prs){
				$win = $B.window({
					title:'[(${Lang.common_xlsExport})]',
					width:400,
					dataType:'iframe',
					height:200,
					content: $B.getHttpHost(ctxPath) + "func/page/exportXls"
				});
			},
			importFn:function(prs){
				$win = $B.window({
					title:'[(${Lang.common_xlsImport})]',
					dataType:'iframe',
					width:500,
					height:250,
					content: $B.getHttpHost(ctxPath) + "func/page/importXls"
				});
			}
		};
		function formatMenu(c,r){
			return r.extFeildsMap.menuText;
		} 
		function formatLog(c,r){
			if(c === "1"){
				return "[(${Lang.common_yes})]";
			}else{
				return "[(${Lang.common_no})]";
			}
		}
</script>
</body>
</html>
